/**
  ******************************************************************************
  * @file    dev_time.h
  * @brief
  * @author  zp
  * @version V1.0.0
  * @date    2024/01/29
  ******************************************************************************
  */

#ifndef __DEV_TIME_H__
#define __DEV_TIME_H__


/* Includes ------------------------------------------------------------------*/

/* Bsp includes. */
#include <stdint.h>

/* Os includes. */

/* User includes. */

/* Public macro --------------------------------------------------------------*/

/* Private macro -------------------------------------------------------------*/

/* Type defines --------------------------------------------------------------*/
typedef struct {
	uint32_t second;
	uint64_t msecond;
}timeval_t;

typedef struct {
	uint32_t day;
	uint32_t hour;
	uint32_t min;
	uint32_t second;
}timedate_t;

typedef struct dev_time_tag dev_time_t;

struct dev_time_tag{
	uint64_t local_ticks;
	uint32_t sec2tick;

	void(*local_tick_inc)(dev_time_t*);
	void(*gettimeofday)(dev_time_t*, timedate_t*);
	void(*time)(dev_time_t*, timeval_t*);
};

/* Private variables ---------------------------------------------------------*/
extern dev_time_t dev_time;

/* Private Enum --------------------------------------------------------------*/

/* Private Union -------------------------------------------------------------*/

/* Private Struct ------------------------------------------------------------*/

/* Pubilc function prototypes ------------------------------------------------*/
int DevTime_Init(void);


#endif // __DEV_TIME_H__


